/*
 * SemanticWebImporterPanel.java
 *
 * Created on Dec 4, 2011, 7:24:31 PM
 */

package fr.inria.edelweiss.semantic.importer;

import fr.inria.edelweiss.sparql.corese.CoreseDriver;
import java.util.List;

/**
 *
 * @author edemairy
 */


public class SemanticWebImporterPanel extends javax.swing.JPanel {
    private CoreseDriver driver;

    /** Creates new form SemanticWebImporterPanel */
    public SemanticWebImporterPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jSplitPane1 = new javax.swing.JSplitPane();
        sparqlQueryEditor = new fr.inria.acacia.corese.gui.query.SparqlQueryEditor();
        coreseDriverParametersPanel = new fr.inria.edelweiss.sparql.corese.CoreseDriverParametersPanel();

        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        jSplitPane1.setRightComponent(sparqlQueryEditor);
        jSplitPane1.setLeftComponent(coreseDriverParametersPanel);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private fr.inria.edelweiss.sparql.corese.CoreseDriverParametersPanel coreseDriverParametersPanel;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSplitPane jSplitPane1;
    private fr.inria.acacia.corese.gui.query.SparqlQueryEditor sparqlQueryEditor;
    // End of variables declaration//GEN-END:variables

    public void addResource(String lastFileName) {
        coreseDriverParametersPanel.addResource(lastFileName);
    }
    
    public void setSparqlRequest(final String request) {
        sparqlQueryEditor.setQueryText(request);
    }

    String getSparqlRequest() {
        return sparqlQueryEditor.getQueryText();
    }
    
    public List<String> getResourceList() {
        List<String> result = coreseDriverParametersPanel.getResourceList();
        return result;
    }

    void setDriver(CoreseDriver driver) {
        this.driver = driver;
        coreseDriverParametersPanel.setParameters(driver.getParameters());
    }

}
